<!DOCTYPE html>













<html class="theme-next gemini" lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">










  <meta name="google-site-verification" content="true">







  <meta name="baidu-site-verification" content="true">



  
  
  <link rel="stylesheet" href="/lib/fancybox/source/jquery.fancybox.css">







<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2">

<link rel="stylesheet" href="/css/main.css?v=7.1.2">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.1.2">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.ico?v=7.1.2">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.ico?v=7.1.2">


  <link rel="mask-icon" href="/images/logo.svg?v=7.1.2" color="#222">







<script id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '7.1.2',
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false,"dimmer":false},
    back2top: true,
    back2top_sidebar: true,
    fancybox: true,
    fastclick: false,
    lazyload: true,
    tabs: true,
    motion: {"enable":false,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="前言反反复复搞了很多天，终于搭建好自己的博客了，因为要配置的个性化东西很多，而且网上查找的结果都是比较零散的，所以我搭建博客时浪费了很多时间，也走了很多的坑。为了节约大家的时间，方便大家搭建自己的博客，特地记录下搭建的过程。如果大家在搭建过程中有什么疑问，欢迎留言，同时也请大家收藏网站，防止自己忘记!!!">
<meta name="keywords" content="博客,hexo,next">
<meta property="og:type" content="article">
<meta property="og:title" content="史上最全hexo+GitHubPages搭建个人博客">
<meta property="og:url" content="https://melville.club/posts/a-2019-01-09-14-12-57.html">
<meta property="og:site_name" content="Melville&#39;s blog">
<meta property="og:description" content="前言反反复复搞了很多天，终于搭建好自己的博客了，因为要配置的个性化东西很多，而且网上查找的结果都是比较零散的，所以我搭建博客时浪费了很多时间，也走了很多的坑。为了节约大家的时间，方便大家搭建自己的博客，特地记录下搭建的过程。如果大家在搭建过程中有什么疑问，欢迎留言，同时也请大家收藏网站，防止自己忘记!!!">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E5%88%9B%E5%BB%BA%E4%BB%93%E5%BA%93.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E5%88%9B%E5%BB%BA%E4%BB%93%E5%BA%93%E5%90%8D%E5%AD%97.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E5%88%9B%E5%BB%BA%E6%88%90%E5%8A%9F.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E6%9F%A5%E7%9C%8B%E4%BB%93%E5%BA%93%E8%AE%BE%E7%BD%AE.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E6%9F%A5%E7%9C%8BGitHubpages%E7%BD%91%E5%9D%80.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/Git%E5%AE%89%E8%A3%85%E6%88%90%E5%8A%9F.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E8%B4%A6%E6%88%B7%E8%AE%BE%E7%BD%AE.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/GIT%E6%96%B0%E5%BB%BASSH%20key.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E8%BE%93%E5%85%A5SSHkey.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/sshkey%E6%B7%BB%E5%8A%A0%E6%88%90%E5%8A%9F.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E4%BB%93%E5%BA%93URL.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/hexo%E5%88%9D%E5%A7%8B%E5%8C%96%E5%90%8E%E7%9A%84%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/hexo%E5%88%9D%E5%A7%8B%E5%8C%96%E7%95%8C%E9%9D%A2.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/config%E6%96%87%E4%BB%B6.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/config%E6%96%87%E4%BB%B6%E9%85%8D%E7%BD%AEdeploy.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/preo%E5%9C%B0%E5%9D%80.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/GitHub%E5%88%9B%E5%BB%BA%E5%88%86%E6%94%AF.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E7%82%B9%E5%87%BB%E5%88%86%E6%94%AF.png">
<meta property="og:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E6%94%B9%E5%8F%98%E5%88%86%E6%94%AF.png">
<meta property="og:updated_time" content="2019-06-13T08:05:10.834Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="史上最全hexo+GitHubPages搭建个人博客">
<meta name="twitter:description" content="前言反反复复搞了很多天，终于搭建好自己的博客了，因为要配置的个性化东西很多，而且网上查找的结果都是比较零散的，所以我搭建博客时浪费了很多时间，也走了很多的坑。为了节约大家的时间，方便大家搭建自己的博客，特地记录下搭建的过程。如果大家在搭建过程中有什么疑问，欢迎留言，同时也请大家收藏网站，防止自己忘记!!!">
<meta name="twitter:image" content="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E5%88%9B%E5%BB%BA%E4%BB%93%E5%BA%93.png">



  <link rel="alternate" href="/atom.xml" title="Melville's blog" type="application/atom+xml">



  
  
  <link rel="canonical" href="https://melville.club/posts/a-2019-01-09-14-12-57">



<script id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>史上最全hexo+GitHubPages搭建个人博客 | Melville's blog</title>
  












  <noscript>
  <style>
  .use-motion .motion-element,
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-title { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Melville's blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <h1 class="site-subtitle" itemprop="description">业精于勤，荒于嬉</h1>
      
    
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">

    
    
    
      
    

    
      
    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-about">

    
    
    
      
    

    
      
    

    <a href="/about/" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">

    
    
    
      
    

    
      
    

    <a href="/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签<span class="badge">38</span></a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">

    
    
    
      
    

    
      
    

    <a href="/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类<span class="badge">13</span></a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">

    
    
    
      
    

    
      
    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档<span class="badge">20</span></a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-milestone">

    
    
    
      
    

    
      
    

    <a href="/milestone/" rel="section"><i class="menu-item-icon fa fa-fw fa-flag-checkered"></i> <br>里程碑</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-message">

    
    
    
      
    

    
      
    

    <a href="/message/" rel="section"><i class="menu-item-icon fa fa-fw fa-list-alt"></i> <br>留言板</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-commonweal">

    
    
    
      
    

    
      
    

    <a href="/404/" rel="section"><i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br>公益 404</a>

  </li>

      
      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>搜索</a>
        </li>
      
    </ul>
  

  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



  



</div>
    </header>

    
  
  

  

  <a href="https://github.com/do-do-do" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="external nofollow noopener noreferrer" target="_blank"><svg width="80" height="80" viewbox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"/><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"/><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"/></svg></a>



    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://melville.club/posts/a-2019-01-09-14-12-57.html">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Melville">
      <meta itemprop="description" content="改革春风吹满地">
      <meta itemprop="image" content="/images/avatar.png">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Melville's blog">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">史上最全hexo+GitHubPages搭建个人博客

              
            
          </h2>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2019-01-09 14:12:57" itemprop="dateCreated datePublished" datetime="2019-01-09T14:12:57+08:00">2019-01-09</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2019-06-13 16:05:10" itemprop="dateModified" datetime="2019-06-13T16:05:10+08:00">2019-06-13</time>
              
            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing"><a href="/categories/博客/" itemprop="url" rel="index"><span itemprop="name">博客</span></a></span>

                
                
              
            </span>
          

          
            
            
              
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
            
                <span class="post-meta-item-text">评论数：</span>
                <a href="/posts/a-2019-01-09-14-12-57.html#comments" itemprop="discussionUrl">
                  <span class="post-comments-count valine-comment-count" data-xid="/posts/a-2019-01-09-14-12-57.html" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="post-meta-item-icon">
            <i class="fa fa-heart"></i>
             阅读次数： 
            <span class="busuanzi-value" id="busuanzi_value_page_pv"></span>
            </span>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <script type="text/javascript" src="/js/src/baidu.js"></script>

<h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>反反复复搞了很多天，终于搭建好自己的博客了，因为要配置的个性化东西很多，而且网上查找的结果都是比较零散的，所以我搭建博客时浪费了很多时间，也走了很多的坑。为了节约大家的时间，方便大家搭建自己的博客，特地记录下搭建的过程。如果大家在搭建过程中有什么疑问，<strong>欢迎留言</strong>，同时也请大家收藏网站，防止自己忘记!!!</p>
<a id="more"></a>
<h1 id="1-GitHub-Pages和hexo简介"><a href="#1-GitHub-Pages和hexo简介" class="headerlink" title="1. GitHub Pages和hexo简介"></a>1. GitHub Pages和hexo简介</h1><blockquote>
<p>GitHub Pages旨在从GitHub存储库托管您的个人，组织或项目页面，是为您和您的项目快速发布漂亮网站的最佳方式。使用GitHub Pages搭建个人网站，可以省去购买服务器、域名等一系列费用，搭建起来非常简单。而且可以上传网页的源代码、更改网页的样式，全部在自己的掌控之中。</p>
</blockquote>
<blockquote>
<p>Hexo 是一款基于Node.js的快速、简洁且高效的博客框架。Hexo 使用 Markdown（或其他渲染引擎）解析文章，在几秒内，即可利用靓丽的主题生成静态网页。依赖少易于安装使用，是搭建博客的首选框架。</p>
</blockquote>
<h1 id="2-创建GitHub-Pages"><a href="#2-创建GitHub-Pages" class="headerlink" title="2. 创建GitHub Pages"></a>2. 创建GitHub Pages</h1><h2 id="2-1-注册GitHub"><a href="#2-1-注册GitHub" class="headerlink" title="2.1 注册GitHub"></a>2.1 注册GitHub</h2><p>如果你看到这篇文章，90%的可能性已经是GitHub会员了，这里就不介绍注册步骤了，<strong><a href="https://github.com/" rel="external nofollow noopener noreferrer" target="_blank">GitHub入口</a>。</strong></p>
<h2 id="2-2-创建仓库"><a href="#2-2-创建仓库" class="headerlink" title="2.2 创建仓库"></a>2.2 创建仓库</h2><p>进入GitHub个人页面，点击右上角的 <strong>+</strong> 号新建仓库。</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E5%88%9B%E5%BB%BA%E4%BB%93%E5%BA%93.png" alt=""></p>
<p>在新建仓库页面，输入仓库名字，选择pulic和初始化README，点击 <code>Create repository</code> 新建仓库，如下图所示。</p>
<font color="#FF0000">注意：仓库名字一定要和自己的用户名一样，规则就是 <code>用户名.github.io</code>。不这样命名会出错。</font>

<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E5%88%9B%E5%BB%BA%E4%BB%93%E5%BA%93%E5%90%8D%E5%AD%97.png" width="60%" height="60%"></p>
<p>创建完成后，在个人仓库页面会出现刚才创建的仓库，点击仓库名称进入仓库。</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E5%88%9B%E5%BB%BA%E6%88%90%E5%8A%9F.png" width="60%" height="60%"></p>
<p>进入仓库后，点击Settings，往下翻，查看仓库的GitHub Pages，已经分配了一个网址，这个网址就是你的博客地址，可以访问。</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E6%9F%A5%E7%9C%8B%E4%BB%93%E5%BA%93%E8%AE%BE%E7%BD%AE.png" width="60%" height="60%"></p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E6%9F%A5%E7%9C%8BGitHubpages%E7%BD%91%E5%9D%80.png" width="60%" height="60%"></p>
<h1 id="3-安装工具并设置"><a href="#3-安装工具并设置" class="headerlink" title="3. 安装工具并设置"></a>3. 安装工具并设置</h1><h2 id="3-1-安装Git，关联自己的远程仓库"><a href="#3-1-安装Git，关联自己的远程仓库" class="headerlink" title="3.1 安装Git，关联自己的远程仓库"></a>3.1 安装Git，关联自己的远程仓库</h2><p>Git是开源的分布式版本控制系统，用于敏捷高效地处理项目。我们网站在本地搭建好了，需要使用Git同步到GitHub上。Git是一个工具，GitHub是用于托管项目的网站，不要搞混淆了。 <strong><a href="https://git-scm.com/download/win" rel="external nofollow noopener noreferrer" target="_blank">Git下载地址</a></strong><br>下载并安装完成后，鼠标右键点击桌面（或文件系统的其它地方），会出现 <code>Git GUI Here</code>, <code>Git Bash Here</code> 两个选项。</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/Git%E5%AE%89%E8%A3%85%E6%88%90%E5%8A%9F.png" alt=""></p>
<p>点击 <code>Git Bash Here</code>，打开命令窗口。输入以下指令设置Git用户信息。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git config --global user.name &quot;你的GitHub用户名&quot;</span><br><span class="line">git config --global user.email &quot;你的GitHub注册邮箱&quot;</span><br></pre></td></tr></table></figure>
<p>生成ssh密钥文件</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh-keygen -t rsa -C &quot;你的GitHub注册邮箱&quot;</span><br></pre></td></tr></table></figure>
<p>输入这个命令时会提示一些信息，直接三次回车即可，然后在 <code>C:\Users\用户名\.ssh</code> 目录下会生成两个文件 <code>id_rsa</code> 和 <code>id_rsa.pub</code>。 <code>id_rsa</code>是私钥文件，<code>id_rsa.pub</code>是公钥文件。将 <code>id_rsa.pub</code>用记事本打开，拷贝文件里面的所有内容。 然后打开GitHub个人主页，点击右上角的头像，选择Settings</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E8%B4%A6%E6%88%B7%E8%AE%BE%E7%BD%AE.png" alt=""></p>
<p>找到 <code>SSH and GPG keys</code>，点击 <code>New SSH key</code>。</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/GIT%E6%96%B0%E5%BB%BASSH%20key.png" width="70%" height="70%"></p>
<p>输入标题和key的内容，点击 <strong>Add SSH key</strong></p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E8%BE%93%E5%85%A5SSHkey.png" width="70%" height="70%"></p>
<p>在Git Bash中检测GitHub公钥设置是否成功，输入</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh git@github.com</span><br></pre></td></tr></table></figure>
<p>结果如下图所示，则说明设置成功</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/sshkey%E6%B7%BB%E5%8A%A0%E6%88%90%E5%8A%9F.png" alt=""></p>
<blockquote>
<p><strong>GitHub添加SSH key的目的：</strong>通过非对称加密的公钥与私钥来完成加密，公钥放置在GitHub上，私钥放置在自己的电脑里。GitHub要求每次推送代码都是合法用户，所以每次推送都需要输入账号密码验证推送用户是否是合法用户，为了省去每次输入密码的步骤，采用了SSH，当你推送的时候，Git就会匹配你的私钥跟GitHub上面的公钥是否是配对的，若是匹配就认为你是合法用户，则允许推送。这样可以保证每次的推送都是正确合法的。</p>
</blockquote>
<h2 id="3-2-clone远程仓库到本地"><a href="#3-2-clone远程仓库到本地" class="headerlink" title="3.2 clone远程仓库到本地"></a>3.2 clone远程仓库到本地</h2><p>不克隆仓库也可以正常部署博客，这一步的目的是为了方便提交本地的配置文件到GitHub上，在 <strong>5.2</strong> 章节会提到。<br>在本地新建一个空文件夹，克隆刚才新建的仓库</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git clone 仓库的URL</span><br></pre></td></tr></table></figure>
<p>其中，仓库的URL可从仓库主页获取，如下图：</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E4%BB%93%E5%BA%93URL.png" alt=""></p>
<h2 id="3-3-安装node-js"><a href="#3-3-安装node-js" class="headerlink" title="3.3 安装node.js"></a>3.3 安装node.js</h2><p><a href="https://nodejs.org/en/download/" rel="external nofollow noopener noreferrer" target="_blank">Node.js下载</a>，注意安装Node.js会包含环境变量及npm的安装，安装后，检测Node.js和npm是否安装成功，在命令行中输入</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">node -v   #显示版本号则说明安装成功</span><br><span class="line">npm -v    #显示版本号则说明安装成功</span><br></pre></td></tr></table></figure>
<h2 id="3-4-安装hexo"><a href="#3-4-安装hexo" class="headerlink" title="3.4 安装hexo"></a>3.4 安装hexo</h2><p>进入我们在 <strong>3.2</strong> 章节中创建的文件夹中，按住shift键，右击鼠标点击命令行（或者是powershell，都是一样的）。输入</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g hexo-cli</span><br></pre></td></tr></table></figure>
<p>开始安装hexo，<font color="#FF0000">注意，安装hexo以及下面对hexo初始化的操作，一定要在刚才创建的文件夹中进行。</font></p>
<h1 id="4-初始化博客以及常用命令"><a href="#4-初始化博客以及常用命令" class="headerlink" title="4. 初始化博客以及常用命令"></a>4. 初始化博客以及常用命令</h1><p>hexo安装完成后，开始对其进行初始化</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo init</span><br></pre></td></tr></table></figure>
<p>初始化的过程稍微有点长，需要等待一会儿。初始化完成之后，文件夹下面应该有这些文件</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/hexo%E5%88%9D%E5%A7%8B%E5%8C%96%E5%90%8E%E7%9A%84%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84.png" alt=""></p>
<blockquote>
<p><strong>node_modules：</strong> 框架，一般不用改动</p>
</blockquote>
<blockquote>
<p><strong>scaffolds：</strong> scaffolds就是脚手架的意思，这里放了三个模板文件，分别是新添加博客文章（posts）、新添加博客页（page）和新添加草稿（draft）的目标样式。这部分可以修改的内容是，我们可以在模板上添加比如categories等自定义内容</p>
</blockquote>
<blockquote>
<p><strong>source：</strong> source是放置我们博客内容的地方，里面初始只有两个文件夹，一个是drafts（草稿），一个posts（文章），但之后我们通过命令新建tags（标签）还有categories（分类）页后，这里会相应地增加文件夹。</p>
</blockquote>
<blockquote>
<p><strong>themes：</strong> 放置主题文件包的地方。Hexo会根据这个文件来生成静态页面。初始状态下只有landscape一个文件夹，后续我们可以添加自己喜欢的。</p>
</blockquote>
<blockquote>
<p><strong>config.yml：</strong> 博客的配置文件，博客的名称、关键词、作者、语言、博客主题…设置都在里面。</p>
</blockquote>
<blockquote>
<p><strong>package.json：</strong> 应用程序信息，新添加的插件内容也会出现在这里面，我们可以不修改这里的内容。</p>
</blockquote>
<p>测试一下，依次输入</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">hexo g</span><br><span class="line">hexo s</span><br></pre></td></tr></table></figure>
<p>打开浏览器，输入 <code>localhost:4000</code>，回车，出现</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/hexo%E5%88%9D%E5%A7%8B%E5%8C%96%E7%95%8C%E9%9D%A2.png" alt=""></p>
<p>OK，博客搭建已经完成一半了，接下来我先介绍几个常用的命令</p>
<table>
<thead>
<tr>
<th style="text-align:center">命令</th>
<th style="text-align:center">简写</th>
<th style="text-align:left">描述</th>
<th style="text-align:left">备注</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">hexo init [folder]</td>
<td style="text-align:center">-</td>
<td style="text-align:left">在指定目录初始化博客</td>
<td style="text-align:left">如果不加[folder]参数，则默认在当前目录初始化</td>
</tr>
<tr>
<td style="text-align:center">hexo clean</td>
<td style="text-align:center">-</td>
<td style="text-align:left">清除缓存文件 (db.json) 和已生成的静态文件 (public)</td>
<td style="text-align:left"></td>
</tr>
<tr>
<td style="text-align:center">hexo generate</td>
<td style="text-align:center">hexo g</td>
<td style="text-align:left">生成静态文件</td>
<td style="text-align:left">-</td>
</tr>
<tr>
<td style="text-align:center">hexo deploy</td>
<td style="text-align:center">hexo d</td>
<td style="text-align:left">部署网站</td>
<td style="text-align:left">可以和hexo g合并成 hexo g -d，生成静态网页并部署网站，用的比较多</td>
</tr>
<tr>
<td style="text-align:center">hexo version</td>
<td style="text-align:center">hexo -v</td>
<td style="text-align:left">查看hexo版本</td>
<td style="text-align:left">-</td>
</tr>
<tr>
<td style="text-align:center">hexo new [layout] [filename]</td>
<td style="text-align:center">-</td>
<td style="text-align:left">新建一篇文章</td>
<td style="text-align:left">如果没有设置 layout 的话，默认使用 _config.yml 中的 default_layout 参数代替。如果标题包含空格的话，请使用引号括起来。</td>
</tr>
<tr>
<td style="text-align:center">hexo publish [layout] [filename]</td>
<td style="text-align:center">-</td>
<td style="text-align:left">发表草稿</td>
<td style="text-align:left">-</td>
</tr>
<tr>
<td style="text-align:center">hexo server</td>
<td style="text-align:center">hexo s</td>
<td style="text-align:left">启动服务器。默认情况下，访问网址为： <a href="http://localhost:4000/" rel="external nofollow noopener noreferrer" target="_blank">http://localhost:4000/</a></td>
<td style="text-align:left">加参数-p，可以指定端口号</td>
</tr>
<tr>
<td style="text-align:center">hexo list [type]</td>
<td style="text-align:center">-</td>
<td style="text-align:left">列出网站指定类型的资料</td>
<td style="text-align:left">type类型可以是 page, post, route, tag, category等</td>
</tr>
</tbody>
</table>
<h1 id="5-GitHub-Pages和hexo关联"><a href="#5-GitHub-Pages和hexo关联" class="headerlink" title="5. GitHub Pages和hexo关联"></a>5. GitHub Pages和hexo关联</h1><h2 id="5-1-更改hexo站点配置文件"><a href="#5-1-更改hexo站点配置文件" class="headerlink" title="5.1 更改hexo站点配置文件"></a>5.1 更改hexo站点配置文件</h2><p>打开文件夹下面的_config.yml文件</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/config%E6%96%87%E4%BB%B6.png" alt=""></p>
<p>翻到最后，填写配置</p>
<p><font color="#FF0000">注意<code>:</code>号后面有一个空格</font>。如下图所示</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/config%E6%96%87%E4%BB%B6%E9%85%8D%E7%BD%AEdeploy.png" alt=""></p>
<p>其中,repo可以在你新建的仓库中获取到</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/preo%E5%9C%B0%E5%9D%80.png" alt=""></p>
<h2 id="5-2-给仓库创建分支"><a href="#5-2-给仓库创建分支" class="headerlink" title="5.2 给仓库创建分支"></a>5.2 给仓库创建分支</h2><p>这里的branch填的是master，这个master是你建立的github.io仓库的主干，用于存放生成的静态网页，你从自己博客网站上看到的东西都是在master这个主干上，而我们本地存放的不仅有博客文章，还有网站的配置文件，这就引发了一个问题，如果我们的电脑硬盘坏了，这些配置文件就丢了，我们再想更改网站的配置，就只能从头再来。所以我们要及时对这些文件做好备份，最好的方法当然是备份到GitHub上，我们可以在master的基础上创建一个分支，比如叫hexo，把网站的配置文件都放在hexo分支上，如果我们电脑硬盘坏了或者想换电脑了，直接从hexo分支上pull到本地即可。下面是创建的方法：</p>
<p>直接在此处输入hexo，如果没有这个分支，会提示创建，直接回车即可创建hexo分支。如下图所示</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/GitHub%E5%88%9B%E5%BB%BA%E5%88%86%E6%94%AF.png" alt=""></p>
<p>点击 <strong>branches</strong>，将GitHub的默认分支改成hexo</p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E7%82%B9%E5%87%BB%E5%88%86%E6%94%AF.png" alt=""></p>
<p><img src="http://melville-images.oss-cn-shanghai.aliyuncs.com/blog/%E5%8F%B2%E4%B8%8A%E6%9C%80%E5%85%A8hexo-GitHubPages%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/%E6%94%B9%E5%8F%98%E5%88%86%E6%94%AF.png" alt=""></p>
<p>创建好以后，就可以将我们本地的文件提交到hexo上了。关于git的命令，大家自己百度学习。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">git add .               # 添加所有文件</span><br><span class="line">git commit -m &quot;描述&quot;    # 提交</span><br><span class="line">git push origin hexo    # push到hexo分支上</span><br></pre></td></tr></table></figure>
<h1 id="6-新建一篇博客，并部署"><a href="#6-新建一篇博客，并部署" class="headerlink" title="6. 新建一篇博客，并部署"></a>6. 新建一篇博客，并部署</h1><p>首先安装Git部署插件</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure>
<p>接下来就可以写博客啦，我们先新建一个文章，部署上去看看效果。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">hexo new myTestFile</span><br><span class="line">hexo g -d</span><br></pre></td></tr></table></figure>
<p>部署完成后，打开你的博客网址：https://用户名.github.io，在主页上就能看到你刚才的文章啦。</p>
<h1 id="7-添加个性主题及配置"><a href="#7-添加个性主题及配置" class="headerlink" title="7. 添加个性主题及配置"></a>7. 添加个性主题及配置</h1><p>由于文章内容较多，主题配置放在了另两篇文章，<br><a href="https://melville.club/posts/a-2019-01-10-15-31-50.html"> <strong>hexo站点配置+next主题配置（一）</strong> </a><br><a href="https://melville.club/posts/a-2019-01-15-15-32-00.html"> <strong>hexo站点配置+next主题配置（二）</strong> </a></p>
<h1 id="9-自定义域名"><a href="#9-自定义域名" class="headerlink" title="9. 自定义域名"></a>9. 自定义域名</h1><p>由于文章内容较多，自定义域名放在了另一篇文章，<br><a href="https://melville.club/posts/a-2019-01-10-15-32-40.html"> <strong>hexo的自定义域名</strong> </a></p>
<hr>

      
    </div>

    

    
    
    

    
        
    

    

    
      
    
    
      <div>
        <div id="reward-container">
  <div></div>
  <button id="reward-button" disable="enable" onclick="var qr = document.getElementById(&quot;qr&quot;); qr.style.display = (qr.style.display === 'none') ? 'block' : 'none';">
    打赏
  </button>
  <div id="qr" style="display: none;">

    
      
      
        
      
      <div style="display: inline-block">
        <img src="/images/wechatpay.jpg" alt="Melville 微信支付">
        <p>微信支付</p>
      </div>
    
      
      
        
      
      <div style="display: inline-block">
        <img src="/images/alipay.jpg" alt="Melville 支付宝">
        <p>支付宝</p>
      </div>
    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/博客/" rel="tag"><i class="fa fa-tag"></i> 博客</a>
          
            <a href="/tags/hexo/" rel="tag"><i class="fa fa-tag"></i> hexo</a>
          
            <a href="/tags/next/" rel="tag"><i class="fa fa-tag"></i> next</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/posts/a-2019-01-07-17-52-13.html" rel="next" title="Windows10企业版激活方法">
                <i class="fa fa-chevron-left"></i> Windows10企业版激活方法
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/posts/a-2019-01-10-15-31-50.html" rel="prev" title="hexo站点配置+next主题配置（一）">
                hexo站点配置+next主题配置（一） <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  
    <div class="comments" id="comments">
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/images/avatar.png" alt="Melville">
            
              <p class="site-author-name" itemprop="name">Melville</p>
              <div class="site-description motion-element" itemprop="description">改革春风吹满地</div>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">20</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  
                    
                      <a href="/categories/">
                    
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">13</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  
                    
                      <a href="/tags/">
                    
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">38</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="https://github.com/do-do-do" title="GitHub &rarr; https://github.com/do-do-do" rel="external nofollow noopener noreferrer" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="https://www.weibo.com/3938468211/profile?rightmod=1&wvr=6&mod=personinfo&is_all=1" title="WeiBo &rarr; https://www.weibo.com/3938468211/profile?rightmod=1&wvr=6&mod=personinfo&is_all=1" rel="external nofollow noopener noreferrer" target="_blank"><i class="fa fa-fw fa-weibo"></i>WeiBo</a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="/y.dark.woood@gmail.com" title="E-Mail &rarr; y.dark.woood@gmail.com"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="https://twitter.com/Melville_IT_Dog" title="Twitter &rarr; https://twitter.com/Melville_IT_Dog" rel="external nofollow noopener noreferrer" target="_blank"><i class="fa fa-fw fa-twitter"></i>Twitter</a>
                </span>
              
            </div>
          

          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-inline">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-umbrella"></i>
                友情链接
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.aqh.space" title="https://www.aqh.space" rel="external nofollow noopener noreferrer" target="_blank">qinghua</a>
                  </li>
                
              </ul>
            </div>
          

          
            
          
          

        </div>
      </div>

      
      <!--noindex-->
        <div class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
            
            
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#前言"><span class="nav-text">前言</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#1-GitHub-Pages和hexo简介"><span class="nav-text">1. GitHub Pages和hexo简介</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#2-创建GitHub-Pages"><span class="nav-text">2. 创建GitHub Pages</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#2-1-注册GitHub"><span class="nav-text">2.1 注册GitHub</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-2-创建仓库"><span class="nav-text">2.2 创建仓库</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#3-安装工具并设置"><span class="nav-text">3. 安装工具并设置</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#3-1-安装Git，关联自己的远程仓库"><span class="nav-text">3.1 安装Git，关联自己的远程仓库</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-2-clone远程仓库到本地"><span class="nav-text">3.2 clone远程仓库到本地</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-3-安装node-js"><span class="nav-text">3.3 安装node.js</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-4-安装hexo"><span class="nav-text">3.4 安装hexo</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#4-初始化博客以及常用命令"><span class="nav-text">4. 初始化博客以及常用命令</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#5-GitHub-Pages和hexo关联"><span class="nav-text">5. GitHub Pages和hexo关联</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#5-1-更改hexo站点配置文件"><span class="nav-text">5.1 更改hexo站点配置文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-2-给仓库创建分支"><span class="nav-text">5.2 给仓库创建分支</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#6-新建一篇博客，并部署"><span class="nav-text">6. 新建一篇博客，并部署</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#7-添加个性主题及配置"><span class="nav-text">7. 添加个性主题及配置</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#9-自定义域名"><span class="nav-text">9. 自定义域名</span></a></li></ol></div>
            

          </div>
        </div>
      <!--/noindex-->
      

      
        <div class="back-to-top">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>
  


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2018 – <span itemprop="copyrightYear">2019</span>
  <span class="with-love" id="animate">
    <i class="fa fa-snowflake-o"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Melville</span>

  

  
</div>









        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="post-meta-item-icon">
      <i class="fa fa-user"></i>
    </span>
    <span class="site-uv" title="总访客量">
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  

  
    <span class="post-meta-divider">|</span>
  

  
    <span class="post-meta-item-icon">
      <i class="fa fa-users"></i>
    </span>
    <span class="site-pv" title="总访问量">
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>









        
      </div>
    </footer>

    

    

    

    
  </div>

  

<script>
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>







  






  



  
    
    
  
  <script color="0,0,255" opacity="0.5" zindex="-1" count="99" src="/lib/canvas-nest/canvas-nest.min.js"></script>













  
  <script src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script src="/lib/fancybox/source/jquery.fancybox.pack.js"></script>


  


  <script src="/js/utils.js?v=7.1.2"></script>

  <script src="/js/motion.js?v=7.1.2"></script>



  
  


  <script src="/js/affix.js?v=7.1.2"></script>

  <script src="/js/schemes/pisces.js?v=7.1.2"></script>




  
  <script src="/js/scrollspy.js?v=7.1.2"></script>
<script src="/js/post-details.js?v=7.1.2"></script>



  


  <script src="/js/next-boot.js?v=7.1.2"></script>


  

  

  

  
  

<script src="//cdn1.lncld.net/static/js/3.11.1/av-min.js"></script>



<script src="//unpkg.com/valine/dist/Valine.min.js"></script>

<script>
  var GUEST = ['nick', 'mail', 'link'];
  var guest = 'nick,mail';
  guest = guest.split(',').filter(function(item) {
    return GUEST.indexOf(item) > -1;
  });
  new Valine({
    el: '#comments',
    verify: true,
    notify: true,
    appId: 'pvhiBwpfHOUBspkJ5iEJ5LFw-gzGzoHsz',
    appKey: 'LrKlAVEWOYfv1JwbdQGXAl3K',
    placeholder: '欢迎留言',
    avatar: 'mm',
    meta: guest,
    pageSize: '10' || 10,
    visitor: false,
    lang: 'zh-cn' || 'zh-cn'
  });
</script>




  


  
  <script>
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url).replace(/\/{2,}/g, '/');
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x"></i></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x"></i></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  

  

  

  

  
  <script>
    (function(){
      var bp = document.createElement('script');
      var curProtocol = window.location.protocol.split(':')[0];
      bp.src = (curProtocol === 'https') ? 'https://zz.bdstatic.com/linksubmit/push.js' : 'http://push.zhanzhang.baidu.com/push.js';
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(bp, s);
    })();
  </script>


  

  

  

  

  

  
<script>
  $('.highlight').not('.gist .highlight').each(function(i, e) {
    var $wrap = $('<div>').addClass('highlight-wrap');
    $(e).after($wrap);
    $wrap.append($('<button>').addClass('copy-btn').append('复制').on('click', function(e) {
      var code = $(this).parent().find('.code').find('.line').map(function(i, e) {
        return $(e).text();
      }).toArray().join('\n');
      var ta = document.createElement('textarea');
      var yPosition = window.pageYOffset || document.documentElement.scrollTop;
      ta.style.top = yPosition + 'px'; // Prevent page scroll
      ta.style.position = 'absolute';
      ta.style.opacity = '0';
      ta.readOnly = true;
      ta.value = code;
      document.body.appendChild(ta);
      ta.select();
      ta.setSelectionRange(0, code.length);
      ta.readOnly = false;
      var result = document.execCommand('copy');
      
        if (result) $(this).text('复制成功');
        else $(this).text('复制失败');
      
      ta.blur(); // For iOS
      $(this).blur();
    })).on('mouseleave', function(e) {
      var $b = $(this).find('.copy-btn');
      setTimeout(function() {
        $b.text('复制');
      }, 300);
    }).append(e);
  })
</script>


  

  

</body>
</html>
